package com.clover.web;

import com.clover.exception.AppException;
import com.clover.exception.WebException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author FoLafClover
 * @date 2018/5/7/007
 */
@Controller
public class TestController {

    @RequestMapping( "/")
    public ModelAndView error() throws Exception{
        throw new WebException("系统异常");
    }

    @RequestMapping("rest")
    public String rest() throws Exception{
        throw new AppException("Json 异常");
    }

    @RequestMapping( "hello" )
    @ResponseBody
    public String hello(){
        return "hello";
    }
}
